<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <title>评论监测系统</title>
</head>
<body>
  <h2>请输入评论：</h2>
  <textarea id="comment" rows="4" cols="50"></textarea><br><br>
  <button onclick="analyze()">提交分析</button>
  <p id="result"></p>
 
  <script>
    async function analyze() {
      const text = document.getElementById("comment").value;
      const response = await fetch("/predict", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ text })
      });
      const data = await response.json();
      document.getElementById("result").innerText = "模型判定结果：" + data.label;
    }
  </script>
</body>
</html>